import Vue from 'vue'
import Confirm from './index.vue'

const ConfirmBox = Vue.extend(Confirm)

Confirm.install = function (options) {
  if (typeof options === 'string') {
    options = {
      title: options
    }
  }

  let instance = new ConfirmBox({
    data: options
  }).$mount()

  document.body.appendChild(instance.$el)

  Vue.nextTick(() => {
    instance.visible = true
  })
}

export default Confirm